﻿--获取通告List
CREATE PROCEDURE [dbo].[proc_Notice_GetList_Group]
(
	@Title nvarchar(200),
	@StartIndex int,
	@EndIndex int
)
as	
	Begin
		
		;WITH list As(Select ROW_NUMBER() OVER (Order By IsDing DESC,UpTime DESC)AS Row,
			N.Id,
			N.NId,
			N.Fid,
			(select title from notice_category where id=N.fid) as category,
			N.Title,
			N.Content,
			(select e.ename from employee e where e.username = n.upname) as UpName,
			N.IsAll,
			N.IsDing,
			N.CreateTime,
			N.UpTime 
		From Notice N 
		Where IsAll=1 And (@Title is null Or N.Title like '%'+ @Title +'%') 
		)
		Select * From list Where Row between @StartIndex and @EndIndex
	
	End
	RETURN
